#include <QCoreApplication>
#include <QDir>
#include <QDebug>

void test1()
{
    QString rootPath = "d:/";

    QDir root(rootPath);
    if(root.exists())
    {
        qDebug() << root.currentPath();
        QDir::setCurrent(rootPath);
        qDebug() << root.currentPath();

        QStringList localEntryList = root.entryList();
        QStringListIterator it(localEntryList);

        while (it.hasNext()) {
            QString fileName = it.next();
            QString childPath(rootPath);
            childPath.append(fileName);
            qDebug() << childPath;
//            qDebug() << fileName << endl;
        }
//        qDebug() << rootPath;
    }
}

void test2()
{
    QString rootPath = "d:/";

    QDir root(rootPath);
    if(root.exists())
    {
        QFileInfoList localEntryInfoList = root.entryInfoList(QDir::Dirs);
        QList<QFileInfo>::const_iterator it = localEntryInfoList.begin();
        for(;it != localEntryInfoList.end();it++)
        {
            QFileInfo fi = *it;
            qDebug() << fi.path();
            qDebug() << fi.filePath();
//            qDebug() << fi.absolutePath();
        }
    }
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

//    test1();

    test2();


    return a.exec();
}
